package com.wie.staffhubpro.mapper;

import com.wie.staffhubpro.domain.entity.Project;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wie.staffhubpro.domain.vo.ProjectVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author WiedersehenM
* @description 针对表【project】的数据库操作Mapper
* @createDate 2025-06-26 21:48:34
* @Entity com.wie.staffhubpro.domain.entity.Project
*/
@Mapper
public interface ProjectMapper extends BaseMapper<Project> {

    /**
     * 查询所有项目
     */
    @Select("select p.id, p.project_name, p.start_date, p.status, pd.dept_id, pe.emp_id as projMan, " +
            "(select count(pe_sub.id) from project_emp pe_sub where pe_sub.proj_id = p.id) as count " +
            "from project p, project_dept pd, project_emp pe " +
            "where p.id = pd.proj_id and p.id = pe.proj_id and pe.responsibility = 0")
    List<ProjectVO> selectProjectVOList();
}




